﻿function callServer() {
	new Ajax.Request(
		"hkd2usd.cgi",
		{	method:"get",
			parameters: { hkd : $F("hkd") },
			onSuccess:
				function(transport) {
					var response = transport.responseText;
					$("usd").update( $F("hkd") + " HKD = " + response + " USD");
				},
			onCreate:
				function(resp) {
					$("usd").update("calculating...");
			}
		}
	);
}

function setup() {
	 $("hkd").onkeyup = callServer;
};

window.onload = setup;
	
